home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Multimedia / Resource Library: Multimedia.iso / maestro / source / ntwrkprt / sender.h < prev   
Encoding:
C/C++ Source or Header  |  1993-06-15  |  6.4 KB  |  143 lines

  1. /*
  2.  * Copyright (c) 1990, 1991 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, and distribute this software and 
  5.  * its documentation for any purpose is hereby granted without fee, provided
  6.  * that (i) the above copyright notices and this permission notice appear in
  7.  * all copies of the software and related documentation, and (ii) the name
  8.  * Stanford may not be used in any advertising or publicity relating to
  9.  * the software without the specific, prior written permission of
  10.  * Stanford.
  11.  * 
  12.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
  13.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY 
  14.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
  15.  *
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
  17.  * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES
  18.  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT
  19.  * ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY,
  20.  * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  21.  * SOFTWARE.
  22.  */
  23.  
  24. /* $Header: /Source/Media/drapeau/NetworkProtocol/RCS/Sender.h,v 1.18 92/09/24 14:07:14 drapeau Exp $ */
  25. /* $Log:    Sender.h,v $
  26.  * Revision 1.18  92/09/24  14:07:14  drapeau
  27.  * Modified code to support asynchronous messaging (actually, to be precise,
  28.  * the code now supports one-way RPC's, but conceptually the programmer should
  29.  * think of the messaging as non-blocking).  In Sun RPC, if an RPC call has
  30.  * a timeout value of zero, the sender will not block waiting for a return.
  31.  * To support this model, a new method was added to the Sender object, called
  32.  * "SenderAsynchronousMessaging()".  It will enable or disable synchronous
  33.  * messaging for the sender passed in as argument.  It does this by modifying
  34.  * the Sender's "timeOut" field.  Also, each message in the Sender object
  35.  * modifies a variable global to the NetworkProtocol library; this variable
  36.  * is called "SenderTimeOut" and is used by each message in the Sender class.
  37.  * When a message is sent, the responsible method first sets the SenderTimeOut
  38.  * variable to the timeOut field of the current Sender.
  39.  * Because of these changes, it is no longer necessary to create default
  40.  * timeout values when a New Sender is created (via the NewSender() method).
  41.  * Thus, the code to do so was removed.
  42.  * A final note: the "sender->timeOut" field is new to this version of the code.
  43.  * 
  44.  * Revision 1.17  92/05/29  12:40:42  drapeau
  45.  * Changed the name of the "Selection" structure to "MAESelection",
  46.  * to avoid name conflicts with other software packages and toolkits
  47.  * that might also define a "Selection" structure.
  48.  * 
  49.  * Revision 1.16  91/11/25  13:02:08  drapeau
  50.  * Added definition of the special hostname "AnyHost".
  51.  * 
  52.  * Revision 1.15  91/09/26  23:25:10  drapeau
  53.  * Added several new definitions, all of which are used by the
  54.  * SenderGetPortFromName() method.  WaitTimeInMicroSeconds is the initial time
  55.  * that SenderGetPortFromName() waits after it has launched an application
  56.  * before it checks to see if the new application is alive.
  57.  * OneSecond is one second, in microseconds, to be used by usleep().
  58.  * LaunchNewApp is a string constant used to specify that a new copy of an
  59.  * application should be opened, whether a copy of that application is already
  60.  * running or not.
  61.  * 
  62.  * Also, defined a new function, SenderLaunchApplication(), used by
  63.  * SenderGetPortFromName().
  64.  * 
  65.  * Revision 1.14  91/09/18  12:42:04  drapeau
  66.  * - Modified the definition of the SenderGetPortFromName() method; the additional argument,
  67.  *   PortArray** matchingPortsReturn, holds a list of matching Ports after the message has been
  68.  *   answered.
  69.  * - Changed the name of the major include file from LinkProtocol.h to MAEstro.h, to better reflect
  70.  *   the project.
  71.  * 
  72.  * Revision 1.13  91/06/19  14:10:06  drapeau
  73.  * Added support for five new messages:
  74.  *  - PauseSelection
  75.  *  - ResumeSelection
  76.  *  - HideApplication
  77.  *  - ShowApplication
  78.  *  - GetAppIcon
  79.  * Also, replaced the "PerformPartialSelection" message with
  80.  * "HaltSelection" message.
  81.  * 
  82.  * Revision 1.12  91/06/17  18:17:25  drapeau
  83.  * Added copyright notice.
  84.  * 
  85.  * Revision 1.11  91/02/28  07:20:01  drapeau
  86.  * This version uses a new version numbering scheme and a new version of RCS.
  87.  * Also, minor change to definition of SenderGetSelection(), to make this
  88.  * method more consistent with other Sender methods that return data to the
  89.  * caller.  The new definition allows SenderGetSelection() to allocate space
  90.  * for a Selection* and make the caller's Selection* point to that new space.
  91.  * 
  92.  * Revision 1.1  1990/10/24  18:28:34  drapeau
  93.  * Initial revision
  94.  * */
  95.  
  96. #ifndef _Sender_
  97. #define _Sender_
  98.  
  99. static char SenderHeaderRcsid[] = "$Header: /Source/Media/drapeau/NetworkProtocol/RCS/Sender.h,v 1.18 92/09/24 14:07:14 drapeau Exp $";
  100.  
  101. #include <MAEstro.h>
  102.  
  103. #define WaitTimeInMicroSeconds    4000000                    /* 4 million microseconds = 4 seconds */
  104. #define OneSecond        1000000
  105. #define LaunchNewApp        ":LaunchNewApp:"            /* Used by SenderGetPortFromName */
  106. #define AnyHost            ":AnyHost:"                /* Used by SenderGetPortFromName */
  107. #define On            1                    /* Used by SenderSynchronousMessaging */
  108. #define Off            0                    /* Used by SenderSynchronousMessaging */
  109.  
  110. typedef struct _Sender
  111. {
  112.   CLIENT*        clientPtr;
  113.   int            clientSocket;
  114.   int            portNumber;
  115.   struct timeval    timeOut;
  116. } Sender;
  117.  
  118. extern struct timeval*    SenderTimeOut;
  119.  
  120. Sender*    NewSender(Port*);
  121. void    DestroySender(Sender*);
  122. int    SenderOpenDocument(Sender* sender, char* documentName);
  123. int    SenderGetCurrentDocName(Sender* sender, char** documentNameReturn);
  124. int    SenderGetSelection(Sender* sender, MAESelection** selectionReturn);
  125. int    SenderSetSelection(Sender* sender, MAESelection* selection);
  126. int    SenderPerformSelection(Sender* sender);
  127. int    SenderConnectWithPortMgr(Sender* sender, Port* receivingPort);
  128. int    SenderGetOpenApps(Sender* sender, PortArray** openAppsReturn);
  129. int    SenderGetPortFromName(Sender* sender, Port* appNameAndHost, PortArray** matchingPortsReturn);
  130. int    SenderPortNumber(Sender* sender);
  131. int    SenderDisconnectFromPortMgr(Sender* sender, Port* appPort);
  132. int    SenderPing(Sender* sender);
  133. int    SenderHaltSelection(Sender* sender);
  134. int    SenderPauseSelection(Sender* sender);
  135. int    SenderResumeSelection(Sender* sender);
  136. int    SenderHideApplication(Sender* sender);
  137. int    SenderShowApplication(Sender* sender);
  138. int    SenderGetAppIcon(Sender* sender, IconData** iconDataReturn);
  139. int    SenderLaunchApplication(char* appName);
  140. int    SenderSynchronousMessaging(Sender* sender, int onOff);
  141.  
  142. #endif
  143.